package extrace.ui.main;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;

import extrace.ui.domain.ExpressEditActivity;
import extrace.ui.misc.CustomerListActivity;

public class MainFragment extends Fragment {
	
    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container, false);
        //fragment_main中的操作激发

		rootView.findViewById(R.id.linlay1).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartReceiveExpress();
					}
				});
        rootView.findViewById(R.id.linlay2).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartQueryExpress();
					}
				});


		rootView.findViewById(R.id.linlay3).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartChaibaoExpress();
					}
				});
		rootView.findViewById(R.id.linlay4).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartDabaoExpress();
					}
				});
        //包裹拆包和打包在这里

        rootView.findViewById(R.id.linlay5).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartCustomerList();
					}
				});

        rootView.findViewById(R.id.linlay6).setOnClickListener(
				new View.OnClickListener() {
					@Override
					public void onClick(View view) {
						StartQueryExpress();
					}
				});


        return rootView;
    }

	void StartChaibaoExpress()
	{
		Intent intent = new Intent();
		intent.putExtra("Action","Chaibao");
		intent.setClass(this.getActivity(), ExpressEditActivity.class);
		startActivityForResult(intent, 0);
	}
	void StartDabaoExpress()
	{
		Intent intent = new Intent();
		intent.putExtra("Action","Dabao");
		intent.setClass(this.getActivity(), ExpressEditActivity.class);
		startActivityForResult(intent, 0);
	}

    void StartReceiveExpress()
    {
		Intent intent = new Intent();
		intent.putExtra("Action","New");
		intent.setClass(this.getActivity(), ExpressEditActivity.class);
		startActivityForResult(intent, 0);  	
    }

    void StartQueryExpress()
    {
		Intent intent = new Intent();
		intent.putExtra("Action","Query");
		intent.setClass(this.getActivity(), ExpressEditActivity.class);
		startActivityForResult(intent, 0);  	
    }

    void StartCustomerList()
    {
		Intent intent = new Intent();
		intent.putExtra("Action","None");
		intent.setClass(this.getActivity(), CustomerListActivity.class);
		startActivityForResult(intent, 0);
    }

}
